﻿@{
    ViewBag.Title = "后台登录";
    Layout = null;
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"><title>
	后台登录
</title>
    <link type="image/x-icon" rel="shortcut icon" href="http://www.szhome.com/favicon.ico" />
    <link href="/style/manage/css/loginv1.0.css" rel="stylesheet" type="text/css" />
</head>
<body id="login">
<div id="login-wrapper" >
  <div id="login-top">
    <img src="/style/manage/images/logo.gif" width="316" height="65"/>
  </div>
    <div id="login-content">
        <div class="notification">
            <h3>用户登陆</h3>
        </div>
	    <div class="content">
            <ul>
                <li><label>用户名：</label><input type="text" id="uName" class="input" /></li>
                <li><label>密　码：</label><input type="password" id="Pwd" class="input" /></li>
                <li><input type="button" id="btnLogin" class="button" /></li>
            </ul>
        </div>
    </div>
  @*<div id="login-content">
        
  </div>*@
</div>
<script src="/style/web/js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#btnLogin").bind("click", function () {
            Login();
        });

        $('#Pwd').bind('keyup', function (event) {
            if (event.keyCode == 13) {
                Login();
            }
        });
    });

    function Login() {
        var username = $('#uName').val();
        var password = $('#Pwd').val();
        if (username == "") {
            alert("用户名不能为空");
            $('#uName').focus();
            return;
        }
        if (password == "") {
            alert("密码不能为空");
            $('#Pwd').focus();
            return;
        }

        $.ajax({
            type: "post",
            url: "/manage/login/login",
            data: { username: username, password: password },
            dataType: "json",
            timeout: 30000, //over time：30s
            success: function (data) {
                if (data.code == 0) {
                    if ("@ViewBag.returnUrl" != "") {
                        window.location.href = "@ViewBag.returnUrl";
                    }
                    else {
                        window.location.href = '/manage/home';
                    }
                }
                else {
                    alert(data.msg);
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                dlg.Msg.Err(errorThrown);
            }
        });
    }
</script>
</body>
</html>

